<div class="adv">    
    <?php
    if(isset($ad_list))
    {
        $size = $ad_list->getSize();
        if($size > 0)
        {
            for($i = 0;$i < $size;$i++)
            {
                $row = $ad_list->getRow($i);
                if(strlen($row->link) == 0)
                {
                ?>
                <img src="<?php echo $row->image?>" alt="<?php echo $row->description; ?>" title="<?php echo $row->description; ?>"/>
                <?php
                }
                else
                {
                ?>
                <a href="<?php echo $row->link; ?>"><img src="<?php echo $row->image;?>" alt="<?php echo $row->description; ?>" title="<?php echo $row->description; ?>"/></a>
                <?php
                }
            }
        }
    }
    ?>
</div>